<template>
  <div>

    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/index' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>系统中心</el-breadcrumb-item>
      <el-breadcrumb-item>借贷管理</el-breadcrumb-item>
      <el-breadcrumb-item>招标管理</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card>
<!--    <el-row>-->
<!--      <el-form :model="userForm" label-width="70px">-->
<!--        <el-col :span="5">-->
<!--          <el-form-item label="姓名">-->
<!--            <el-input placeholder="借款方" v-model="userForm.fullName"></el-input>-->
<!--          </el-form-item>-->
<!--        </el-col>-->
<!--      </el-form>-->
<!--      <el-button type="info" plain @click="search()">搜索</el-button>-->
<!--      <el-button type="primary" @click="centerDialogVisible = true">添加用户</el-button>-->
<!--    </el-row>-->
    <el-table
      :data="biaolist"
      style="width: 100%">
      <el-table-column
        align="center"
        type="index"
        label="编号">
      </el-table-column>
      <el-table-column
        align="center"
        prop="bidName"
        label="标名">
      </el-table-column>
      <el-table-column
        align="center"
        prop="tag"
        label="标签">
      </el-table-column>
      <el-table-column
        align="center"
        prop="bidType"
        label="标的类型">
        <template slot-scope="scope">
          {{scope.row.bidType|bidTypefit}}
        </template>
      </el-table-column>
      <el-table-column
        align="center"
        prop="interestMode"
        label="投资计息方式">
        <template slot-scope="scope">
          {{scope.row.interestMode|interestModefilt}}
        </template>
      </el-table-column>
      <el-table-column
        align="center"
        prop="proDesc"
        label="项目介绍">
      </el-table-column>
      <el-table-column
        align="center"
        prop="rcms"
        label="风控措施">
      </el-table-column>
      <el-table-column
        align="center"
        prop="raiseAmount"
        label="募集金额">
      </el-table-column>
      <el-table-column
        align="center"
        prop="totalAmount"
        label="借款金额">
      </el-table-column>
      <el-table-column
        align="center"
        label="借款进度">
        <template slot-scope="scope">
          <el-progress :text-inside="true" :stroke-width="26" :percentage=scope.row.jd></el-progress>
        </template>
      </el-table-column>
      <el-table-column
        align="center"
        prop="status"
        label="状态">
        <template slot-scope="scope">
          {{scope.row.status|statusFit}}
        </template>
      </el-table-column>



      <el-table-column
        align="center"
        label="操作">
        <template slot-scope="scope">
          <el-dropdown size="mini" split-button type="primary" trigger="click">
            操作
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item v-if="scope.row.status==4" @click.native="update(scope.row.id,7)">审核通过</el-dropdown-item>
              <el-dropdown-item v-if="scope.row.status==4" @click.native="update(scope.row.id,8)">审核不通过</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      align="center"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="page.pagenum"
      :page-sizes="[5, 10, 15, 20]"
      :page-size="page.pagesize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total">
    </el-pagination>
    </el-card>

<!--    {{biaolist}}-->
<!--    {{total}}-->
  </div>
</template>
<script>
  export default {
    name: "Biaocheck",
    data(){
      return{
        biaolist:[],
        page:{
          pagenum:0,
          pagesize:5
        },
        total:0,
        userForm:{},
      }
    },
    methods:{
      update:function(id,status){//修改标的状态
        this.$http.post("/finance-service-borrowing/ebankbidinfo/updateStatus01/"+id+"/"+status).then((res)=>{
          if(res.data.success){
            this.$message({
              message:res.data.message,
              type: 'success'
            });
          }else{
            this.$message.error(res.data.message);
          }
          this.search();
        })

      },
      handleSizeChange:function (val) {
        this.page.pagesize=val;
        this.search();
      },
      handleCurrentChange:function (val) {
        this.page.pagenum=val;
        this.search();
      },
      search:function () {//招标管理列表
        this.$http.post("/finance-service-borrowing/ebankbidinfo/biaocheckmg/"+this.page.pagenum+"/"+this.page.pagesize,this.userForm).then(
          (res)=>{
            this.biaolist=res.data.result.list;
            this.total=res.data.result.total;
          }
        )
      },
    },
    filters:{
      statusFit:function (val) {//标的状态
        if (val==0){
          return "未发标";
        }
        if (val==1){
          return "募集中"
        }
        if (val==2){
          return "撤标"
        }
        if (val==4){
          return "满标"
        }
        if (val==7){
          return "已放款"
        }
        if (val==8){
          return "不通过"
        }
      },
      interestModefilt:function(val){//计算利息的方式
        if(val==0){
          return "成交日"
        }
        if(val==1){
          return "T+1"
        }
        if(val==2){
          return "T+2"
        }
        if(val==3){
          return "成立计息"
        }
      },
      bidTypefit:function (val) {//标的类型过滤器
        if(val==0){
          return "车贷宝"
        }
        if(val==1){
          return "房贷宝"
        }
        if(val==2){
          return "供应链金融"
        }

      }
    },
    mounted() {
      this.search();
    }
  }
</script>

<style scoped>

</style>
